//
//  SidebarCountTransformer.m
//  SolarSeek
//
//  Created by Marcelo Alves on 16/01/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "SidebarCountTransformer.h"
#import "SolarSeekStore.h"

@implementation SidebarCountTransformer
+ (Class)transformedValueClass {
	return [NSNumber class];
}

+ (BOOL)allowsReverseTransformation{
	return NO;
}

- (id)transformedValue:(id)value{
	NSManagedObject *item = (NSManagedObject *) value;
  if ([item valueForKey:@"parent"]) 
    return [item valueForKeyPath:@"children.count"];
  else
    return [NSNumber numberWithInt:-1];
}
@end
